package com.tm.d11_SimpleDateFormat;

import java.util.Calendar;
import java.util.Date;

/**
 * 2024/5/24 Cjj Calendar使用  10：14
 */
public class Test2Calendar {
    public static void main(String[] args) {
        Calendar now = Calendar.getInstance();
        System.out.println(now);

        //获取日历中的某个信息
        System.out.println(now.get(Calendar.YEAR));//获取年
        System.out.println(now.get(Calendar.DAY_OF_YEAR));//获取天
        System.out.println(now.get(Calendar.MONTH));

        //拿到日历中记录的日期对象
        System.out.println(now.getTime());
        System.out.println(now.getTimeInMillis());

        //修改日历的某个信息
        now.set(Calendar.YEAR,2026);

        //为某个信息增加/减少指定的值
        now.add(Calendar.MONTH,3);
        System.out.println(now);


    }
}
